package com.workcell.workdata.im.model.dto;


import com.farsunset.cim.model.Message;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.workcell.workdata.im.constant.MessageFormat;


public class TagMessage {

    /**
     * 房间号
     */
    private String tag;

    private String action;
    private String content;
    private Long sender;
    private String extra;
    protected Byte format = MessageFormat.TEXT;
    private long timestamp;

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Long getSender() {
        return sender;
    }

    public void setSender(Long sender) {
        this.sender = sender;
    }

    public Byte getFormat() {
        return format;
    }

    public void setFormat(Byte format) {
        this.format = format;
    }

    public String getExtra() {
        return extra;
    }

    public void setExtra(String extra) {
        this.extra = extra;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }


    @JsonIgnore
    public Message getMessage() {
        Message message = new Message();
        message.setSender(this.sender.toString());
        message.setAction(this.action);
        message.setContent(this.content);
        message.setFormat(this.format.toString());
        message.setExtra(this.extra);
        message.setTimestamp(this.timestamp);
        message.setId(this.timestamp);
        return message;
    }

    public String getTag() {
        return tag;
    }

    public void setTag(String tag) {
        this.tag = tag;
    }
}
